Arduino Countdown Timer using P10 Display

In this article, we make an Arduino Countdown Timer using P10 Display. The counting is done by Arduino and then displayed in the P10 LED module. This project might come in handy for time-keeping purposes during physical games. The details about pin configuration, display specifications, and hardware interfacing between Arduino Nano and P10 are referenced from the “Interfacing P10 single color LED Display with Arduino Nano” article. In this article you will learn two things:

  1. How to display a countdown of 3 minutes in P10.
  2. How to include a Reset feature in the countdown if necessary.

Components Required:

  1. Arduino Nano x1
  2. P10 display module x1
  3. Jumper wires(M to F) x15
  4. Bread Board x1
  5. 10kΩ resistors x2
  6. push buttons(start & Pause) x2
  7. 5V power supply (2Amps) x1

Circuit Description of Arduino Countdown Timer using P10 Display

Arduino Countdown Timer using P10 Display

The connection of the Arduino Countdown Timer using the P10 Display is the same as shown in the previous post “Interfacing P10 single color LED Display with Arduino Nano” with two extra push switches and corresponding pull-down resistors. Switch SW1 is used to start the timer whereas switch SW2 is used to reset the timer.

Displaying a Countdown Timer of 3 Minutes:

We are aiming to display a message “PRESS START” to initiate a countdown. Then after the button is pressed the countdown is shown on the P10 display. Let’s fix the timer to 3 minutes. Lastly, after the counter reaches 0 seconds, it displays Time UP. The code for this program is broken down and explained below.

  • Include necessary libraries and define some variables.

Some important libraries such as <SPI.h> for Serial communication, <DMD.h> for P10 display operations and <TimerOne.h> for interrupt tasks, need to be included in the program. Include the display font library <Arial_black_16.h> and <SystemFont5x7.h> for large and small sized text displays. Also, initialize StartButton as A0, char type array “b[]” and string variable “str” as shown in code. The “StartButtonPress, StartButtonState, and StartButton” variables are used for Starting the countdown action of the timer.

  • Define Scan_module() function:

scan_module() function will check for any incoming data from the Arduino side through the SPI Terminals. If yes, then it will trigger an interrupt pin for certain events.

  • Initialize the Setup function:

Inside setup() set the StartButton in INPUT mode, then initialize the timer and attach the interrupt to the function scan_module() with 5000-microsecond intervals. Here dmd.clearScreen(true) is used to set all pixels LEDs in off state and clear the display board.

  • Define a CheckStartButton() function:

The CheckStartButton() function waits and checks if the start button is pressed.

  • Programming the Void loop() function:

Here the program begins by waiting for the start button to be pressed with the help of the CheckStartButton() function. Then, after the start button is pressed it provides an interactive countdown of 3 minutes. The countdown is displayed at the P10 module as well as in the serial monitor.

  • Code for Display countdown with Reset feature:

During the counting process, if a Reset button is pressed, the countdown resets the Countdown process. After resetting the program starts with a “PRESS START” message indicating the completion of the reset process.

 

 

Leave a Comment